<?php

class User_model extends CI_Model {

    public function __construct() {
        parent::__construct();
        $this->load->database();
    }

    function check() {
        $username = $this->db->escape_str($this->input->post('username'));
        $password = md5($this->input->post('password'));
        $check = FALSE;
        $result = $this->db->query('select username, password from user where username="' . $username . '" and password="' . $password . '"');
        $r = $result->row();
        if (isset($r->username) && isset($r->password)) {
            $check = ($username == $r->username) && ($password == $r->password);
            
        }
        return $check;
    }

}

?>
